#!/bin/bash

for k in {11..20}
do
    floder="k${k}"
    files=$(ls ${1}/${floder})
    for file in $files 
    do 
	input="${1}/${floder}/${file}"

	time1=$(date)
	echo ""
	echo $time1

    	lb=`grep "^c pre_LB " $input | cut -d ' ' -f 3`
    	k=`grep "^c k " $input | cut -d ' ' -f 3`

        echo "timeout 12000 ../../../KDefective -r ${input} -O solve -a CPLEX -D Set -k ${k} -M ${lb} -t 10800"
    	if [ -z "$lb" -a -z "$k" ] 
    	then
            echo "input file: $input"
       	    echo "prework wrong !!!"
    	else 
            timeout 12000 ../../../KDefective -r ${input} -O solve -a CPLEX -D Set -k ${k} -M ${lb} -t 10800
    	fi

    done
done
